home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2002 January / maximum-cd-2002-01.iso / Files / Mechwarrior 4 Mapping / MW4Editor.exe / content / ABLScripts / Bots / EasyBot.abl < prev    next >
Encoding:
Text File  |  2001-07-16  |  2.8 KB  |  108 lines

  1.  
  2. fsm EasyBot : integer;
  3.  
  4.  
  5. //------------------------------------------------------------------
  6.  
  7. // EasyBot:
  8. //   Intended to be a moderately easy opponent for all players,
  9. //     though a bit more challenge than a WussyBot.
  10.  
  11. //------------------------------------------------------------------
  12.  
  13.  
  14. //------------------------------------------------------------------
  15. //     Constants
  16. //------------------------------------------------------------------
  17.  
  18.     const
  19.         #include_ <content\ABLScripts\mwconst.abi>
  20.  
  21. //------------------------------------------------------------------
  22. //     Types
  23. //------------------------------------------------------------------
  24.  
  25.     type
  26.         #include_ <content\ABLScripts\mwtype.abi>
  27.     
  28.  
  29. //------------------------------------------------------------------
  30. //     Variables
  31. //------------------------------------------------------------------
  32.  
  33.     var
  34.         static integer            attackRange;        // At what range do I start shooting?
  35.         static integer            withdrawRange;        // At what range do I withdraw?
  36.  
  37. //------------------------------------------------------------------
  38. //     Init: my initialization function
  39. //------------------------------------------------------------------
  40.  
  41. function Init;
  42.     code
  43.         // script-specific variables
  44.         attackRange        = 9999;
  45.         withdrawRange    = 9999;
  46.  
  47.         SetIgnoreFriendlyFire    (ME,true);
  48.         SetFiringDelay            (ME,2.0,6.0);
  49.         SetSkillLevel            (ME,10,15,0);
  50.         SetAttackThrottle        (ME,50);
  51.         SetIsShotRadius            (ME,160);
  52.         SetEntropyMood            (ME,DEFENSIVE_END);
  53.         SetCurMood                (ME,DEFENSIVE_END);
  54.  
  55.         EnablePerWeaponRayCasting    (ME,TRUE);
  56.  
  57. endfunction;
  58.  
  59. //------------------------------------------------------------------
  60. //    StartState: my initial state
  61. //------------------------------------------------------------------
  62.  
  63. state StartState;
  64.     code
  65.         trans WaitToAmbushState;
  66.  
  67. endstate;
  68.  
  69. //------------------------------------------------------------------
  70. //    WaitInAmbushState: wait for someone to come close enough to attack
  71. //------------------------------------------------------------------
  72.  
  73. state WaitToAmbushState;
  74.     code
  75.         if (Bot_FindEnemy(attackrange)) then
  76.             trans AttackState;
  77.         endif;
  78.  
  79.         OrderMoveLookOut;
  80. endstate;
  81.  
  82. //------------------------------------------------------------------
  83. //    AttackState: the ambush is over -- let's kick some ass!
  84. //------------------------------------------------------------------
  85.  
  86. state AttackState;
  87.     code
  88.         if (LeaveAttackState(withdrawRange)) then
  89.             trans WaitToAmbushState;
  90.         endif;
  91.  
  92.         OrderAttack(TRUE);
  93. endstate;
  94.  
  95. //------------------------------------------------------------------
  96. //    DeadState: OK, I kicked the bucket.
  97. //------------------------------------------------------------------
  98.  
  99. state DeadState;
  100.     code
  101.         orderDie;
  102.  
  103. endstate;
  104.  
  105.  
  106. endfsm.
  107.  
  108.